<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      h2 {
        text-align: center;
      }
    table  {
      text-align: center;
      color: #3e3e3e;
    }


    table {
      /* 合并相邻边框 */
      border-collapse: collapse;
      height: 80px;
      margin: 0 auto;
      text-align: center;
      border-radius: 10px 10px 0 0;
      overflow: hidden;
    }


    /* 给行添加渐变背景颜色 */
     tr:nth-child(1) {
      background-image: linear-gradient(to right, #f46e33, #f057a5);
    }


     tr:nth-child(2) {
      background-image: linear-gradient(to right, #fdf0eb, #fdeff6);
    }


     tr:nth-child(2) :last-child {
      color: #f282bb;
    }


    tr:nth-child(1) th {
      padding: 5px 50px;
      color: #fff;
    }


   
    tr:nth-child(2) th,
    td {
      border: 1px solid #fff;
      line-height: 50px;
    }
  </style>
  </head>
  <body>
    <script>
      let bankCard = prompt('请输入银行卡余额')
      let water = prompt('请输入本月水费')
      let ele = prompt('请输入本月电费')
      let web = prompt('请输入本月网费')
      
      document.write(`
      <h2>2020年12月消费支出</h2>
<table>
  <tr>
    <th>银行卡余额</th>
    <th>水费</th>
    <th>电费</th>
    <th>网费</th>
    <th>银行卡余额</th>
  </tr>
  <tr>
    <td>${bankCard}</td>
    <td>${water}</td>
    <td>${ele}</td>
    <td>${web}</td>
    <td>${bankCard - water - ele - web}</td>
  </tr>
</table>
`)
  </script>
  </body>
</html>